package com.sdtele.tta.models;

import java.sql.Date;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class VoteTask {
   private long id=-1;
   private long ownerId;
   private  String title;
   private String  description;
   private Timestamp  createtime;
   private Date deadLine;
   private int   voteType;
   private String completion;
public long getId() {
	return id;
}
public void setId(long id) {
	this.id = id;
}
public long getOwnerId() {
	return ownerId;
}
public void setOwnerId(long ownerId) {
	this.ownerId = ownerId;
}
public String getTitle() {
	return title;
}
public void setTitle(String title) {
	this.title = title;
}
public String getDescription() {
	return description;
}
public void setDescription(String description) {
	this.description = description;
}
public Timestamp getCreatetime() {
	return createtime;
}
public void setCreatetime(Timestamp createtime) {
	this.createtime = createtime;
}
public Date getDeadLine() {
	return deadLine;
}
public void setDeadLine(Date deadLine) {
	this.deadLine = deadLine;
}
public int getVoteType() {
	return voteType;
}
public void setVoteType(int voteType) {
	this.voteType = voteType;
}

public String getCompletion() {
	return completion;
}
public void setCompletion(String completion) {
	this.completion = completion;
}
@Override
public String toString() {
	return "VoteTask [id=" + id + ", ownerId=" + ownerId + ", title=" + title + ", description=" + description
			+ ", createtime=" + createtime + ", deadLine=" + deadLine + ", voteType=" + voteType + ", completion="
			+ completion + "]";
}

public VoteTaskOut ToVoteTaskOut()
{
	VoteTaskOut voteTaskOut = new VoteTaskOut();
	
	voteTaskOut.setId(id);
	voteTaskOut.setOwnerId(ownerId);
	voteTaskOut.setTitle(title);
	voteTaskOut.setDescription(description);
	voteTaskOut.setVoteType(voteType);
	voteTaskOut.setCompletion(completion);
	DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
	DateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); 
	
	voteTaskOut.setCreatetime(sdf.format(createtime));
	if(deadLine != null)
		voteTaskOut.setDeadLine(sdf1.format(deadLine));
		else
			voteTaskOut.setDeadLine("");
	return voteTaskOut;
	
	}
   
}
